﻿using System;
using System.Web;
using JustinAngel.MetroBlog.Common.Helpers;

namespace JustinAngel.MetroBlog.UI.Core.Feeds
{
    public class FeedRequestService : IFeedRequestService
    {
        public Uri WebsiteURLRootUri
        {
            get
            {
                if (HttpContext.Current == null)
                    return null;

                return new Uri(WebsiteURLRoot);
            }
        }

        public string WebsiteURLRoot
        {
            get
            {

                if (HttpContext.Current == null)
                    return null;

                return HttpContext.Current.Request.Url.ToString().RemoveAnythingAfter("feed");
            }
        }

        public string WebsiteName
        {
            get
            {
                if (HttpContext.Current == null)
                    return null;

                return HttpContext.Current.Request.Url.Host;
            }
        }
    }
}